import request from '@/config/axios'

export interface LevelVO {
  agentLevelId?: number //编号
  agentLevelName?: string //代理等级名称
  agentLevel?: number //代理等级
  picUrl?: string //背景图
  defaultStatus?: boolean
  conditions?: number
  priceType?: number

  sholdPrice?: number
  sholdSku?: EmptyArrayType
  discountPercent?: number
  status?: number
  promoteRule?: EmptyArrayType
  recommendReward?: EmptyArrayType
}
// 查询权重占用情况
export const getUsedLevel = async (params?) => {
  return await request.get({ url: `/trade/brokerage-level/getUsedLevel`, params })
}
// 查询代理等级列表
export const getLevelList = async (params) => {
  return await request.get({ url: `/trade/brokerage-level/page`, params })
}

// 查询代理等级详情
export const getLevel = async (id: number) => {
  return await request.get({ url: `/trade/brokerage-level/get?id=` + id })
}

// 查询代理等级 - 精简信息列表
export const getSimpleLevelList = async () => {
  return await request.get({ url: `/trade/brokerage-level/list-all-simple` })
}

// 新增代理等级
export const createLevel = async (data: LevelVO) => {
  return await request.post({ url: `/trade/brokerage-level/create`, data })
}

// 修改代理等级
export const updateLevel = async (data: LevelVO) => {
  return await request.put({ url: `/trade/brokerage-level/update`, data })
}

// 删除代理等级
export const deleteLevel = async (id: number) => {
  return await request.delete({ url: `/trade/brokerage-level/delete?id=` + id })
}
